package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    /**
     * 查询部门全部信息
     * @return
     */
    @Select("select * from tlias.dept")
    List<Dept> list();

    /**
     * 删除部门信息
     */
    @Delete("delete from tlias.dept where id = #{id}")
    void delete(Integer id);

    /**
     * 新增员部门信息
     * @param dept
     */
    @Insert("insert into tlias.dept(name, create_time, update_time) value (#{name}, #{createTime}, #{updateTime})")
    void insert(Dept dept);

    /**
     * 修改部门信息
     * @param dept
     */
    @Update("update dept set name = #{name}, tlias.dept.update_time = #{updateTime} where tlias.dept.id = #{id};")
    void update(Dept dept);

    /**
     * 查询回显
     * @param id
     * @return
     */
    @Select("select * from tlias.dept where id = #{id}")
    Dept getById(Integer id);
}
